from django import forms
from django.forms import ModelForm

from app01.models import DeviceType,Device,SubProcess


# 在这里创建你的forms表单类

class DeviceTypeForm(ModelForm):
    class Meta:
        model = DeviceType
        fields = '__all__'
        labels = {
            'typename':'设备类型',
        }
        widgets = {
            'typename':forms.TextInput(attrs={
                'class':'form-control',
                'placeholder':'请输入设备类型名称'
            })
        }


class SubProcessForm(ModelForm):
    class Meta:
        model = SubProcess
        fields = '__all__'
        labels = {
            'name':'子工序名称',
            'process':'所属工序',
        }
        widgets = {
            'name':forms.TextInput(attrs={
                'class':'form-control',
                'placeholder':'请输入新的子工序名称'
            }),
            'process':forms.Select(attrs={
                'class':'form-control',
                'placeholder':'请选择所属的工序'
            })
        }